<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta content="" name="Keywords">
	<meta content="" name="Description">
    <title>发表评论 - {$forumname}</title>
	<link rel="shortcut icon" href="/favicon.ico" />
    <!--[if lte IE 9]><script src="{:ADDON_PUBLIC_PATH}/js/watermark.js"></script><![endif]-->
	<!--[if IE 7]><link href="{:ADDON_PUBLIC_PATH}/css/font_awesome_ie7.css" rel="stylesheet" /><![endif]-->
</head>
<body>
	<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<title>发表评论 - </title>
		<meta charset="utf-8">
		<meta content="" name="description">
		<meta content="" name="keywords">
		<meta content="application/xhtml+xml;charset=UTF-8" http-equiv="Content-Type">
		<meta content="no-cache,must-revalidate" http-equiv="Cache-Control">
		<meta content="no-cache" http-equiv="pragma">
		<meta content="0" http-equiv="expires">
		<meta content="telephone=no, address=no" name="format-detection">
		<meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
		<link rel="stylesheet" type="text/css" href="{:ADDON_PUBLIC_PATH}/css/main.css" ></link>
		<link rel="stylesheet" type="text/css" href="{:ADDON_PUBLIC_PATH}/css/dialog.css" ></link>
		<script src="{:ADDON_PUBLIC_PATH}/js/jquery_min.js" ></script>
		<script src="{:ADDON_PUBLIC_PATH}/js/swipe.js" ></script>
		<script src="{:ADDON_PUBLIC_PATH}/js/main.js" ></script>
		<script src="{:ADDON_PUBLIC_PATH}/js/dialog_min.js" ></script>
		<script src="{:ADDON_PUBLIC_PATH}/js/helper_min.js" ></script>
		<script src="{:ADDON_PUBLIC_PATH}/js/input.js" ></script>
		<script>
    		var form_emotion = (function(){
    			var fe = function(){
    				this.values = ["/::)", "/::~", "/::B", "/::|", "/:8-)", "/::<", "/::$", "/::X", "/::Z", "/::'(", "/::-|", "/::@", "/::P", "/::D", "/::O", "/::(", "/::+", "/:–b", "/::Q", "/::T", "/:,@P", "/:,@-D", "/::d", "/:,@o", "/::g", "/:|-)", "/::!", "/::L", "/::>", "/::,@", "/:,@f", "/::-S", "/:?", "/:,@x", "/:,@@", "/::8", "/:,@!", "/:!!!", "/:xx", "/:bye", "/:wipe", "/:dig", "/:handclap", "/:&-(", "/:B-)", "/:<@", "/:@>", "/::-O", "/:>-|", "/:P-(", "/::'|", "/:X-)", "/::*", "/:@x", "/:8*", "/:pd", "/:<W>", "/:beer", "/:basketb", "/:oo", "/:coffee", "/:eat", "/:pig", "/:rose", "/:fade", "/:showlove", "/:heart", "/:break", "/:cake", "/:li", "/:bome", "/:kn", "/:footb", "/:ladybug", "/:shit", "/:moon", "/:sun", "/:gift", "/:hug", "/:strong", "/:weak", "/:share", "/:v", "/:@)", "/:jj", "/:@@", "/:bad", "/:lvu", "/:no", "/:ok", "/:love", "/:<L>", "/:jump", "/:shake", "/:<O>", "/:circle", "/:kotow", "/:turn", "/:skip", "[挥手]", "/:#-0", "[街舞]", "/:kiss", "/:<&", "/:&>"].slice(0, -7);
    				//console.log(this.values);
    				this.spearate= 20
    			}
    
    			fe.prototype = {
    				rend: function(){
    					var that = this;
    					var TPL = '{seprateDiv}<dd><span data-key="{k}_{page}_{v}" style="background-position:{xPos}px 0;"></span></dd>{delHTML}';
    					var res = iTemplate.makeList(TPL, that.values, function(k,v){
    						return {
    							k: k,
    							v: v,
    							page: Math.floor(k/that.spearate),
    							xPos: -24*k,
    							seprateDiv: (0 == k%that.spearate && 0!=k && k!=that.values.length)?"</div><div>":"",
    							delHTML: (19==k%that.spearate||k==(that.values.length-1) )?'<dd><span data-key="-1_-1_/:del" class="del"></span></dd>':''
    						}
    					});
    					
    					$("#list_emotion").html('<div>'+res+'</div>');
    					var nav_span = new Array(Math.ceil(that.values.length/that.spearate));
    					$("#nav_emotion").html('<span class="on">'+nav_span.join("</span><span>")+'</span>');
    					that.bind();
    
    					 window.swiper = new Swipe(document.getElementById('page_emotion'), {
    		                speed:500,
    		                
    		                callback: function(){
    		                	
    		                	$("#nav_emotion span").removeClass("on").eq(this.index).addClass("on");
    		                }
    		            });
    					return that;
    				},
    				bind: function(){
    					$("#list_emotion").on("click", function(evt){						
    						if("SPAN" == evt.target.tagName){
    							var val = evt.target.getAttribute("data-key").split('_');
    							myInput.listen(this, {
    								keyCode: -10,
    								srcElement: document.getElementById("form_article"),
    								value:val[2],
    								imgUrl: '{:ADDON_PUBLIC_PATH}/images/'+ val[0]+".gif"
    							});
    							this.focus();
    						}
    					});
    				}
    
    			}
    
    			return new fe();
    		})();


		 	$().ready(function(){
				form_emotion.rend();
				myInput.maxLength = 140;
			});


			function submit(){
				var form = document.getElementById("form_1");
				var article = document.getElementById("form_article").innerHTML;
				document.getElementById("form_article_hidden").value = article;
				if(article.length == 0){
					alert("请输入评论内容", 2000);return;
				}
				console.log(form.form_article.value);
				console.log(form);
				
				form.submit();
			}

		</script>
	</head>
	<body onselectstart="return true;" ondragstart="return false;" class="discuss_comment">
		<div id="container" class="container">
			<header></header>
			<div class="body">
				<form id="form_1" action="{:U('checkCommentAdd')}" method="post">
					<section class="form_comment">
						<header>
							<ul class="tbox">
								<li>
									<label class="title">评论</label>
							    </li>
								<li class="align_right">
									<a href="javascript:history.go(-1);" class="cancel">取消</a>
								</li>
							</ul>
						</header>
						<article id="form_article" contenteditable="true" onpaste="myInput.listen(this, event);" onkeydown="myInput.listen(this, event);" oninput="myInput.listen(this, event);" placeholder="写评论..." maxlength="10" ></article>
						<input id="form_article_hidden" name="form_article" type="hidden" value="">
						<input name="wecha_id" type="hidden" value="{$_GET['wecha_id']}" />
						<input name="tid" type="hidden" value="{$_GET['tid']|intval}" />
						<input name="token" type="hidden" value="{$_GET['token']}" />
						<footer>
							<div class="align_right">
								<label id="form_count">140 字</label>
							</div>
						</footer>
					</section>
					<section class="form_pic_emotion">
						<div>
							<nav>
								<ul id="nav_nav">
									<li>
										<a href="javascript:;" class="on" onclick="$('#page_emotion').toggleClass('on');"><span class="icons icons_emotion">&nbsp;</span></a>	
									</li>
								</ul>
							</nav>
						</div>
						<div>
							<ul class="page_pic_emotion clear" id="nav_page">
								<li class="page_emotion box_swipe" id="page_emotion">
									<dl id="list_emotion" class="list_emotion pt_10">
										<div>
										
										</div>
									</dl>
									<dt>
										<ol id="nav_emotion" class="nav_emotion">
											<span class="on"></span>
											<span></span>
										</ol>
									</dt>
								</li>
							</ul>
						</div>
					</section>

				</form>
			</div>
			<footer>
				<section class="nav_footer">
					<ul class="box">
						<li>
							<a href="javascript:submit();" class="on" style="width:120px;">
								<span class="icons_publish">&nbsp;</span>
								<label class="pre">确认提交</label>
							</a>
						</li>
					</ul>
				</section>
			</footer>
		</div>
	</body>

</html>
<script type="text/javascript">
window.shareData = {  
            "moduleName":"Forum",
            "moduleID":"",
            "imgUrl": "", 
            "timeLineLink": "{:C('site_url')}{:U('Forum/index',array('token'=>$_GET['token']))}",
            "sendFriendLink": "{:C('site_url')}{:U('Forum/index',array('token'=>$_GET['token']))}",
            "weiboLink": "{:C('site_url')}{:U('Forum/index',array('token'=>$_GET['token']))}",
            "tTitle": "",
            "tContent": ""
        };
</script>
{$shareScript}
</body>

</html>